# -*- coding: utf-8 -*-
# @Time    : 2023/2/7 13:53
# @Author  : kali
from flask import Flask
from flask_migrate import Migrate

from api import auto_load_api
from config import config
from database_init import db
from task import scheduler

app = Flask(__name__)
# flask配置
app.config.from_object(config)

# 初始化数据库
db.init_app(app)

# 定时任务
scheduler.init_app(app)
scheduler.start()

# 数据库迁移
migrate = Migrate(app, db)
auto_load_api(app)


def init():
    app.run()


if __name__ == '__main__':
    init()
